import React, {Component} from 'react';

import {ScrollView, StyleSheet, Text, View} from 'react-native';

import {DebugColors} from 'react-native-debug-tool/lib/utils/DebugConst';
import {showMsg} from 'react-native-debug-tool/lib/utils/DebugUtils';
import DebugManager from 'react-native-debug-tool/lib/DebugManager';

export default class SubViewException extends Component {

    render() {
        return <ScrollView style={{backgroundColor: DebugColors.white}}>
                {DebugManager.getExceptionLogText().map((item, index) => {
                    return <View key={index} style={styles.borderStyle}>
                        <Text style={styles.title} onPress={() => showMsg(item.log)}>日志：
                            <Text style={{color: DebugColors.blue}}>{item.log}</Text>
                        </Text>
                        <Text style={styles.title}>
                            <Text style={{color: DebugColors.text_light}}>时间：</Text>{item.timeStr}
                        </Text>
                    </View>
                })}
        </ScrollView>;
    }
}

const styles = StyleSheet.create({
    title: {
        fontSize: 16,
        marginTop: 1,
        color: DebugColors.text,
        paddingVertical: 5,
        paddingHorizontal: 15,
        backgroundColor: DebugColors.disable,
    },
});
